<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-title" content="阿福易购">
    <meta content="telephone=no" name="format-detection" />
    <meta content="email=no" name="format-detection" />
    <!-- uc、qq浏览器 -->
    <meta name="screen-orientation" content="portrait">
    <meta name="full-screen" content="yes">
    <meta name="browsermode" content="application">
    <meta name="x5-orientation" content="portrait">
    <meta name="x5-fullscreen" content="true">
    <meta name="x5-page-mode" content="app">
    <meta name="HandheldFriendly" content="true">
    <meta name="MobileOptimized" content="320">
    <meta name="keywords" content="{{$SEO['keywords']}}"/>
    <meta name="description" content="{{$SEO['description']}}"/>
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <title>申请售后_{{$SEO['title']}}</title>
    <link rel="stylesheet" href="{{ asset('/build/css/app.min.css') }}">
</head>
<body ontouchstart="">

@inject('pictureService','App\Interfaces\PictureService')

{!! Form::model($orders,['route'=>'wap.my.refund.create','method' => 'get','id'=>'form','class'=>'ui-after-sales-form js-form bl-form bl-formhor','novalidate'=>'novalidate']) !!}
{!! Form::hidden('order_sn',$orders->order_sn,array('class'=>'form-control','placeholder'=>'订单编号'))!!}
{!! Form::hidden('goods_id',$order_goods->goods_id,array('class'=>'form-control','placeholder'=>'商品id'))!!}

<header class="ui-header ui-header-stable  af-header">
    <ul class="ui-row-flex">
        <li class="ui-col ui-flex ui-flex-pack-start">
            <i ontouchstart="window.history.back();" class="ui-icon-return"></i>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-center">
            <h1>申请售后</h1>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-end">
        </li>
    </ul>
</header>

<footer class="ui-footer ui-goods-footer">
    <div class="ui-row-flex">
        <div class="ui-col">
            <button id="submitBtn" class="ui-btn ui-btn-default" type="submit">提交售后申请</button>
        </div>
    </div>
</footer>


<div class="ui-container">


    <div class="ui-my-order-comment">
        <ul class="ui-list ui-list-function ui-border-tb">
            @if($order_goods)
            <li>
                <div data-href="/goods/show/{{$order_goods->goods_id}}" class="ui-list-img">
                    <span style="background-image:url({{$pictureService::thumb($order_goods->goods_thumb, 70, 70)}})"></span>
                </div>
                <div data-href="/goods/show/{{$order_goods->goods_id}}" class="ui-list-info" style="padding-right: 0;">
                    <h4 class="ui-nowrap">{{$order_goods->goods_name}}</h4>
                    <p class="ui-nowrap">¥{{$order_goods->shop_price}} 数量：{{$order_goods->buy_number}}</p>
                </div>
            </li>
            @endif
        </ul>
    </div>

    <section class="ui-panel ui-panel-pure ui-border-t">
        <h2>服务类型

                    @if($errors->has('serviceType'))
                        <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$errors->first('serviceType')}}</label>
                    @endif</h2>
        <ul class="ui-list ui-list-pure ui-border-tb">
            <li class="ui-border-t">
                <!-- <label class="J-changeType ui-btn ui-btn-default" style="margin-right: 10px">申请换货<input type="radio" class="af-hide" name="serviceType" value="1" checked></label>
                <label class="J-changeType ui-btn ui-btn-border">申请退货<input type="radio" class="af-hide" name="serviceType" value="2"></label> -->

                @foreach($afterSalesTypeArr as $key=>$item)

                	<label class="J-changeType ui-btn @if($key==1) ui-btn-default @else ui-btn-border @endif">{{$item}}
                        <input type="radio" class="af-hide" name="after_sales_type" value="{{$key}}"@if($key==1) {{'checked'}} @endif>
                    </label>
                @endforeach
            </li>
        </ul>
    </section>

    <section class="ui-panel ui-panel-pure ui-border-t">
        <h2>提交数量</h2>
        <ul class="ui-list ui-list-pure ui-border-tb">
            <li class="ui-border-t">
                <div class="ui-num-plugin af-border-tb" style="margin-left: 0">
                    <button class="af-border-l af-border-r ui-num-btn ui-num-min" type="button">-</button>
                    <!-- <input class="ui-num-input" type="text" value="{{$order_goods->buy_number}}" min="1" max="{{$order_goods->buy_number}}" readonly> -->
                    {!! Form::text('after_sales_number', $order_goods->buy_number,array('class'=>'ui-num-input','min'=>'1', 'max'=>"$order_goods->buy_number",'required'=>'true', 'placeholder'=>'售后数量'))!!}

                    @if($errors->has('after_sales_number'))
                        <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i> {{$errors->first('after_sales_number')}}</label>
                    @endif
                    <button class="af-border-l af-border-r ui-num-btn ui-num-add" type="button">+</button>
                </div>
                <small class="ui-txt-info">您本次最多可以提交的数量为{{$order_goods->buy_number}}</small>
            </li>
        </ul>
    </section>

    <section class="ui-panel ui-panel-pure ui-border-t">
        <h2>原因
                @if($errors->has('reason'))
                    <label class="control-label" for="inputError" style="color: #dd4b39;"><i class="fa fa-times-circle-o"></i> {{$errors->first('reason')}}</label>
                @endif</h2>
        <div class="ui-form ui-border-t">
            <div style="height: auto" class="ui-form-item ui-form-item-textarea ui-form-item-pure ui-border-b">
                <!-- <textarea placeholder="请填写退换货原因~" required></textarea> -->
		        {!! Form::textarea('reason',old('reason'),array('class'=>'form-textarea','rows'=>'4','maxlength'=>'255','required'=>'true','placeholder'=>'退货原因不能为空,且最多255字' ))!!}

            </div>
        </div>
    </section>

    <section class="ui-panel ui-panel-pure ui-border-t">
        <div class="ui-form ui-border-t">
            <div class="ui-form-item ui-form-item-show ui-border-b">
                <label for="#">联系人</label>
                <!-- <input type="text" value="" data-reg-msg="请填写联系人" required> -->
                {!! Form::text('consignee',old('consignee'),array('class'=>'fn-tinput form-control','required'=>'true','placeholder'=>'客户姓名'))!!}

                @if($errors->has('consignee'))
                    <label class="control-label" for="inputError" style="color: #dd4b39;"><i class="fa fa-times-circle-o"></i> {{$errors->first('consignee')}}</label>
                @endif
            </div>
        </div>
    </section>
    <section class="ui-panel ui-panel-pure ui-border-t">
        <div class="ui-form ui-border-t">
            <div class="ui-form-item ui-form-item-show ui-border-b">
                <label for="#">联系电话</label>
                <!-- <input type="text" value="" data-reg-msg="请填写联系电话" data-reg="(^0\d{2,3}-\d{7,8}$)|(^\d{7,8}$)|(^\d{3,4}-\d{7,8}-\d{1,4}$)|(^\d{7,8}-\d{1,4}$)|(^\d{3,4}-?\d{3,4}-?\d{2,4}$)" required> -->
                {!! Form::text('phone',$orders->mobile,array('class'=>'', 'readonly'=>'readonly','placeholder'=>'手机号码', 'data-reg'=>'(^0\d{2,3}-\d{7,8}$)|(^\d{7,8}$)|(^\d{3,4}-\d{7,8}-\d{1,4}$)|(^\d{7,8}-\d{1,4}$)|(^\d{3,4}-?\d{3,4}-?\d{2,4}$)'))!!}

                @if($errors->has('phone'))
                    <label class="control-label" for="inputError" style="color: #dd4b39;"><i class="fa fa-times-circle-o"></i> {{$errors->first('phone')}}</label>
                @endif
            </div>
        </div>
    </section>

</div>

{!! Form::hidden('_method', 'get') !!}

{!! Form::close() !!}

<script src="{{ asset('/build/lib/zepto.min.js') }}"></script>
<script src="{{ asset('/build/js/frozen.js') }}"></script>
<script src="{{ asset('/build/js/app.min.js') }}"></script>
<script>
    $(function () {
        $('.J-changeType').on('click',function () {
            $(this).addClass('ui-btn-default').removeClass('ui-btn-border');
            $(this).siblings().removeClass('ui-btn-default').addClass('ui-btn-border');
        });
        var form=$('#form');
        form.on('submit',function (e) {
            e.preventDefault();
            var isOk=RegForm(form);
            isOk&&MyAjax(form.attr('action'),'get',form.serialize(),function(res){
                if(res.status){
                    window.location.href='/'+res.data;
                }

            });
            return false;
        });
    });
</script>
</body>
</html>